package client;

import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.network.Client;
import com.jme3.network.HostedConnection;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Sphere;

/**
 *
 * @author Ben
 */
public class ObjectNetplayer
{
    Vector3f Loc;
    String name;
    Vector3f oldLoc;
    String ip;
    int id;
    HostedConnection player;
    public ObjectNetplayer()
    {
        
    }
    public ObjectNetplayer(Vector3f startloc, String givname, HostedConnection c)
    {
        Loc = startloc;
        name = givname;
        id = c.getId();
        doCreate();
    }
    
    public ObjectNetplayer(Vector3f startloc, String givname, Client c)
    {
        Loc = startloc;
        name = givname;
        id = c.getId();
        doCreate();
    }

    private void doCreate()
    {
        Sphere p = new Sphere(5,5,25f);
        Geometry pg = new Geometry(Integer.toString(id),p);
        pg.setLocalTranslation(Loc);
        Material mat = new Material(Main.appref.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
        mat.setBoolean("UseMaterialColors", true);
        mat.setColor("Diffuse",ColorRGBA.Magenta);
        mat.setColor("Specular", ColorRGBA.White);
        mat.setFloat("Shininess", 12);
        mat.setBoolean("VertexLighting", false);
        pg.setMaterial(mat);
        ControlNetplayer pc = new ControlNetplayer(player);
        pg.addControl(pc);
    }
}
